fix(secrets): respect AWS_REGION for secret lookups#26
Conversation
|
Warning Review limit reached
More reviews will be available in 56 minutes and 35 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
Walkthrough
ChangesAWS region selection for secrets
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
nui_shared_utils/secrets_helper.py (1)
45-45: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAvoid hardcoding the AWS service name in
get_secret.Line 45 hardcodes
"secretsmanager"; this violates the repository rule to pass service names via parameters/configuration.As per coding guidelines,
**/*.py: "No hardcoded organization-specific values (service names, currencies, business logic) - accept values as parameters or via configuration instead".Proposed change
-def get_secret(secret_name: str) -> Dict: +def get_secret(secret_name: str, service_name: str = "secretsmanager") -> Dict: @@ - client = session.client(service_name="secretsmanager", region_name=region) + client = session.client(service_name=service_name, region_name=region)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@nui_shared_utils/secrets_helper.py` at line 45, The get_secret helper currently hardcodes the AWS service name in the session.client call, which should instead come from configuration or a parameter. Update get_secret in secrets_helper.py to accept the service name as an argument (or read it from config) and pass that through to session.client, so the function no longer embeds "secretsmanager" directly.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@nui_shared_utils/secrets_helper.py`:
- Line 45: The get_secret helper currently hardcodes the AWS service name in the
session.client call, which should instead come from configuration or a
parameter. Update get_secret in secrets_helper.py to accept the service name as
an argument (or read it from config) and pass that through to session.client, so
the function no longer embeds "secretsmanager" directly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: ec69d16f-2b96-427e-9395-0111f514011d
📒 Files selected for processing (2)
nui_shared_utils/secrets_helper.pytests/test_secrets_helper.py
- Make Secrets Manager region resolution honor AWS_REGION when boto3 has no session region. - Remove the silent ap-southeast-2 fallback so missing region config fails with an explicit error. - Cover the local-run fallback and missing-region failure paths in secrets_helper tests.
c427f13 to
acf0167
Compare
Summary
AWS_REGIONwhen boto3 has no session region.ap-southeast-2fallback so missing region config fails with an explicit error.secrets_helpertests.Review
ruff check nui_shared_utils/secrets_helper.py tests/test_secrets_helper.pyreports pre-existingF841issues intests/test_secrets_helper.pyoutside this change.Changes
nui_shared_utils/secrets_helper.py: resolve Secrets Manager region from boto3 session,AWS_REGION, thenAWS_DEFAULT_REGION; raise a clear error if none is configured.tests/test_secrets_helper.py: add coverage forAWS_REGIONfallback and missing-region failure.Test plan
black nui_shared_utils/secrets_helper.py tests/test_secrets_helper.pypytest tests/test_secrets_helper.py -qpytest tests/test_slack_client.py::TestSendFile -qpytest -qblocked locally by missingsnowflake-sql-api; also shows two order-dependent Slack file-upload failures that pass in isolation.Summary by CodeRabbit
Bug Fixes
Tests